/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package persistencia;

import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author hellen
 */
@Entity
@Table(name = "REGISTRO_PEDIDO")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "RegistroPedido.findAll", query = "SELECT r FROM RegistroPedido r"),
    @NamedQuery(name = "RegistroPedido.findByRegistroPedidoID", query = "SELECT r FROM RegistroPedido r WHERE r.registroPedidoID = :registroPedidoID")})
public class RegistroPedido implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "RegistroPedidoID")
    private Integer registroPedidoID;
    @JoinColumn(name = "RegPed_ProductoID", referencedColumnName = "ProductoID")
    @ManyToOne(optional = false)
    private Producto regPedProductoID;
    @JoinColumn(name = "RegPed_PedidoID", referencedColumnName = "PedidoID")
    @ManyToOne(optional = false)
    private Pedido regPedPedidoID;
    @JoinColumn(name = "RegPed_ClienteID", referencedColumnName = "ClienteID")
    @ManyToOne(optional = false)
    private Cliente regPedClienteID;

    public RegistroPedido() {
    }

    public RegistroPedido(Integer registroPedidoID) {
        this.registroPedidoID = registroPedidoID;
    }

    public Integer getRegistroPedidoID() {
        return registroPedidoID;
    }

    public void setRegistroPedidoID(Integer registroPedidoID) {
        this.registroPedidoID = registroPedidoID;
    }

    public Producto getRegPedProductoID() {
        return regPedProductoID;
    }

    public void setRegPedProductoID(Producto regPedProductoID) {
        this.regPedProductoID = regPedProductoID;
    }

    public Pedido getRegPedPedidoID() {
        return regPedPedidoID;
    }

    public void setRegPedPedidoID(Pedido regPedPedidoID) {
        this.regPedPedidoID = regPedPedidoID;
    }

    public Cliente getRegPedClienteID() {
        return regPedClienteID;
    }

    public void setRegPedClienteID(Cliente regPedClienteID) {
        this.regPedClienteID = regPedClienteID;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (registroPedidoID != null ? registroPedidoID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof RegistroPedido)) {
            return false;
        }
        RegistroPedido other = (RegistroPedido) object;
        if ((this.registroPedidoID == null && other.registroPedidoID != null) || (this.registroPedidoID != null && !this.registroPedidoID.equals(other.registroPedidoID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "persistencia.RegistroPedido[ registroPedidoID=" + registroPedidoID + " ]";
    }
    
}
